/**
 * <copyright>
 * </copyright>
 *

 */
package info.unlp.tesis.qvtoperational.impl;

import info.unlp.tesis.qvtoperational.OCLExpression;
import info.unlp.tesis.qvtoperational.Operation;
import info.unlp.tesis.qvtoperational.OperationCallExp;
import info.unlp.tesis.qvtoperational.QvtoperationalPackage;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Operation Call Exp</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link info.unlp.tesis.qvtoperational.impl.OperationCallExpImpl#getReferresOperation <em>Referres Operation</em>}</li>
 *   <li>{@link info.unlp.tesis.qvtoperational.impl.OperationCallExpImpl#getArgument <em>Argument</em>}</li>
 *   <li>{@link info.unlp.tesis.qvtoperational.impl.OperationCallExpImpl#getArgument1 <em>Argument1</em>}</li>
 *   <li>{@link info.unlp.tesis.qvtoperational.impl.OperationCallExpImpl#getArgument2 <em>Argument2</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class OperationCallExpImpl extends OCLExpressionImpl implements OperationCallExp
{
  /**
   * The default value of the '{@link #getReferresOperation() <em>Referres Operation</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getReferresOperation()
   * @generated
   * @ordered
   */
  protected static final Operation REFERRES_OPERATION_EDEFAULT = Operation.AND;

  /**
   * The cached value of the '{@link #getReferresOperation() <em>Referres Operation</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getReferresOperation()
   * @generated
   * @ordered
   */
  protected Operation referresOperation = REFERRES_OPERATION_EDEFAULT;

  /**
   * The cached value of the '{@link #getArgument() <em>Argument</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getArgument()
   * @generated
   * @ordered
   */
  protected OCLExpression argument;

  /**
   * The cached value of the '{@link #getArgument1() <em>Argument1</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getArgument1()
   * @generated
   * @ordered
   */
  protected OCLExpression argument1;

  /**
   * The cached value of the '{@link #getArgument2() <em>Argument2</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getArgument2()
   * @generated
   * @ordered
   */
  protected OCLExpression argument2;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected OperationCallExpImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return QvtoperationalPackage.Literals.OPERATION_CALL_EXP;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Operation getReferresOperation()
  {
    return referresOperation;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setReferresOperation(Operation newReferresOperation)
  {
    Operation oldReferresOperation = referresOperation;
    referresOperation = newReferresOperation == null ? REFERRES_OPERATION_EDEFAULT : newReferresOperation;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, QvtoperationalPackage.OPERATION_CALL_EXP__REFERRES_OPERATION, oldReferresOperation, referresOperation));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public OCLExpression getArgument()
  {
    return argument;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetArgument(OCLExpression newArgument, NotificationChain msgs)
  {
    OCLExpression oldArgument = argument;
    argument = newArgument;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT, oldArgument, newArgument);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setArgument(OCLExpression newArgument)
  {
    if (newArgument != argument)
    {
      NotificationChain msgs = null;
      if (argument != null)
        msgs = ((InternalEObject)argument).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT, null, msgs);
      if (newArgument != null)
        msgs = ((InternalEObject)newArgument).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT, null, msgs);
      msgs = basicSetArgument(newArgument, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT, newArgument, newArgument));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public OCLExpression getArgument1()
  {
    return argument1;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetArgument1(OCLExpression newArgument1, NotificationChain msgs)
  {
    OCLExpression oldArgument1 = argument1;
    argument1 = newArgument1;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT1, oldArgument1, newArgument1);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setArgument1(OCLExpression newArgument1)
  {
    if (newArgument1 != argument1)
    {
      NotificationChain msgs = null;
      if (argument1 != null)
        msgs = ((InternalEObject)argument1).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT1, null, msgs);
      if (newArgument1 != null)
        msgs = ((InternalEObject)newArgument1).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT1, null, msgs);
      msgs = basicSetArgument1(newArgument1, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT1, newArgument1, newArgument1));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public OCLExpression getArgument2()
  {
    return argument2;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetArgument2(OCLExpression newArgument2, NotificationChain msgs)
  {
    OCLExpression oldArgument2 = argument2;
    argument2 = newArgument2;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT2, oldArgument2, newArgument2);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setArgument2(OCLExpression newArgument2)
  {
    if (newArgument2 != argument2)
    {
      NotificationChain msgs = null;
      if (argument2 != null)
        msgs = ((InternalEObject)argument2).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT2, null, msgs);
      if (newArgument2 != null)
        msgs = ((InternalEObject)newArgument2).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT2, null, msgs);
      msgs = basicSetArgument2(newArgument2, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT2, newArgument2, newArgument2));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT:
        return basicSetArgument(null, msgs);
      case QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT1:
        return basicSetArgument1(null, msgs);
      case QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT2:
        return basicSetArgument2(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case QvtoperationalPackage.OPERATION_CALL_EXP__REFERRES_OPERATION:
        return getReferresOperation();
      case QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT:
        return getArgument();
      case QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT1:
        return getArgument1();
      case QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT2:
        return getArgument2();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case QvtoperationalPackage.OPERATION_CALL_EXP__REFERRES_OPERATION:
        setReferresOperation((Operation)newValue);
        return;
      case QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT:
        setArgument((OCLExpression)newValue);
        return;
      case QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT1:
        setArgument1((OCLExpression)newValue);
        return;
      case QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT2:
        setArgument2((OCLExpression)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case QvtoperationalPackage.OPERATION_CALL_EXP__REFERRES_OPERATION:
        setReferresOperation(REFERRES_OPERATION_EDEFAULT);
        return;
      case QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT:
        setArgument((OCLExpression)null);
        return;
      case QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT1:
        setArgument1((OCLExpression)null);
        return;
      case QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT2:
        setArgument2((OCLExpression)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case QvtoperationalPackage.OPERATION_CALL_EXP__REFERRES_OPERATION:
        return referresOperation != REFERRES_OPERATION_EDEFAULT;
      case QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT:
        return argument != null;
      case QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT1:
        return argument1 != null;
      case QvtoperationalPackage.OPERATION_CALL_EXP__ARGUMENT2:
        return argument2 != null;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (referresOperation: ");
    result.append(referresOperation);
    result.append(')');
    return result.toString();
  }

} //OperationCallExpImpl
